<?php

/**
 * Created by PhpStorm.
 * User: mj
 * Date: 17-5-23
 * Time: 下午3:31
 */
namespace App\Winged\Backend\Oss\Plugins;

use OSS\OssClient;

class Sign implements PluginInterface
{
    public $client;

    public $bucket;

    public function install(OssClient $client, $bucket)
    {
        $this->client = $client;

        $this->bucket = $bucket;
    }

    /**
     * 签名
     * @param $object 签名的地址.
     * @param $timeout
     * @return mixed
     */
    public function doSign($object, $timeout = 3000)
    {
        $signedUrl = $this->client->signUrl($this->bucket, $object, $timeout);
        return $signedUrl;
    }

}